<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
	<%@ page language="java" import="java.util.Date"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>welcome to access！</title>
<script type="text/javascript"
	src="https://code.jquery.com/jquery-1.11.3.js">
	
</script>
<script type="text/javascript">

	var accessResult = [];
	$(document).ready(function search() {
		var number = $("#number").val();
		$.ajax({
			type : "POST",
			url : "searchJsonAccess.action?number="+number,
			dataType : "json",
			success : function(access) {
				$.each(access, function(index, value) {
					accessResult.push(value);
				})
				each(accessResult);
				console.info(accessResult);
				console.info(number);
			 typeof(accessResult.accessCreateTime);
			}
		});
	});

	//遍历显示到table
	function each(accessResult) {
		var html = "";
		$
				.each(
						accessResult,
						function(index1, value1) {

							var trs = "";
							trs += "<tr><td>"
									+ value1.accessId
									+ "</td><td>"
									+ value1.accessName
									+ "</td><td style=\"width:40px;\">"
									+ value1.accessParentId
									+ "</td><td>"
									+ value1.modelId
									+ "</td><td>"
									+ value1.accessCreater
									+ "</td><td>"
									+ value1.accessCreateTime
									+ "</td><td>"
									+ value1.accessModifier
									+ "</td><td>"
									+ value1.accessModifyTime
									+ "</td><td>"
									+ value1.acesssDeleteFlag
									+ "</td><td><button type=\"button\" class=\"btn4\" onclick=\"window.location='goToUpdateAccess.action?accessId="
									+ value1.accessId
									+ "' \">修&nbsp;&nbsp;改</button><button type=\"button\" class=\"btn4\" onclick=\"window.location='logicalDeleteAccess.action?accessId="
									+ value1.accessId
									+ "' \">逻辑删除</button><button type=\"button\" class=\"btn4\" onclick=\"window.location='physicalDeleteAccess.action?accessId="
									+ value1.accessId
									+ "'\">物理删除</button>	</td></tr>";
									
							html += trs;

						})

		$("#table").append(html);

	}
</script>
</head>
<body>

	<!-- 	<input onclick="search()" type="button" value="Save" /> -->

	<button type="button" class="btn2" id="back"
		onclick="window.location='goToAddAccess.action'">Add&nbsp;&nbsp;Access</button>
		<input id="number" type="hidden" value="${sessionScope.number}">

	<table id="table" border="1" class="datalist">
		<tr id="ttbody">
			<th>accessId</th>
			<th>accessName</th>
			<th>accessParentId</th>
			<th>modelId</th>
			<th>accessCreater</th>
			<th>accessCreateTime</th>
			<th>accessModifier</th>
			<th>accessModifyTime</th>
			<th>acesssDeleteFlag</th>
			<th>Operation</th>
		</tr>


	</table>
	<div class="navi"
		style="width: 260px; margin: 0 auto; padding-top: 20px;">
		<a href="searchAccessList.action?number=1">首页</a> <a
			href="searchAccessList.action?number=${sessionScope.number-1}">上一页</a> <a
			href="searchAccessList.action?number=${sessionScope.number+1}">下一页</a> <a
			href="searchAccessList.action?number=${sessionScope.count}">尾页</a> 
			<font>当前第${sessionScope.number}/${sessionScope.count}</font>
	</div>  

</body>
</html>